//
//  JuBaseModel.swift
//  JuSwift
//
//  Created by Juvid on 2020/9/23.
//  Copyright © 2020 Juvid. All rights reserved.
//

import UIKit
import JuSwiftFrameWork


class JusBaseModel: NSObject {

    required convenience init?(coder aDecoder: NSCoder) {
         self.init(coder:aDecoder)
    }
    func testInit() {
        let cls: AnyClass = self.classForCoder
        let classType = cls as? NSObject.Type
//        let anObject = classType
//        let my1 = anObject.init()
        if let anObject = classType {
          let my = anObject.init()
          print(my)
        }
        testClass()
    }
    func testClass(){
        let model1 = JusBaseModel.self.init()
        let model2 = JusBaseModel.self
        model1.testFun()
    }
    func testFun()  {
        print("hello")
    }


    /**
     在Swift中，要创建对象有以下几种方式：

     1、NSString.self()// 或者NSString.self.init()
     2、let myClass = MyClass.Type.init()
     3、let myClass = MyClass.self.init()
     4、let type = NSClassFromString("MyClass") as! MyClass.Type然后通过type.init()来创建对象
     */
}
